package com.yourname.myapplication.data.room.database

import androidx.room.Database
import androidx.room.RoomDatabase
import com.yourname.myapplication.data.model.Question
import com.yourname.myapplication.data.room.dao.QuestionDao
import android.content.Context
import androidx.room.Room
import com.yourname.myapplication.data.model.WrongQuestion
import com.yourname.myapplication.data.room.dao.WrongQuestionDao

@Database(entities = [Question::class], version = 1)
abstract class AppDatabase : RoomDatabase() {
    abstract fun questionDao(): QuestionDao
    companion object {
        private var instance: AppDatabase? = null

        fun getInstance(context: Context): AppDatabase {
            if (instance == null) {
                instance = Room.databaseBuilder(
                    context.applicationContext,
                    AppDatabase::class.java,
                    "app_database"
                ).build()
            }
            return instance!!
        }
    }
}
